using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using UserControls.CustControls;
using ViewModels;

namespace WorkPieceDataCapture.Views
{
    /// <summary>
    /// uc_Search_PointCheck.xaml 的交互逻辑
    /// </summary>
    public partial class uc_Search_PointCheck : UserControl
    {
        public uc_Search_PointCheck()
        {
            InitializeComponent();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var btn = sender as Button;
            var vm = this.DataContext as vm_Search_PointCheck;
            if (vm != null)
            {
                switch (btn.Content.ToString())
                {
                    case "查询":
                        vm.doSearchCommand.Execute(null);
                        break;
                    case "导出":
                        vm.doExportListCommand.Execute(null);
                        break;
                }
            }
        }

        private void event_DateTimePicker(object sender, MouseButtonEventArgs e)
        {
            var vm = this.DataContext as vm_Search_PointCheck;
            if (vm != null)
            {
                vm.SelectDateCommand.Execute(sender);
            }
        }
    }
}
